package asa;

import Lexer.*;

public class CompositeExpr extends Expr {

    public CompositeExpr( Expr pleft, Symbol poper, Expr pright ) {
        left = pleft;
        oper = poper;
        right = pright;
    }

    @Override
	public void genJava(PWInterface pw) {
    	genJava(pw, false);
    }

	public void genJava(PWInterface pw, boolean putParenthesis ) {
        if ( putParenthesis )
           pw.print("(");
        left.genJava(pw, true);
        pw.print(" " + oper.toString() + " ");
        right.genJava(pw, true);
        if ( putParenthesis )
           pw.print(")");
    }

    private Expr left, right;
    private Symbol oper;
}
